﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Web.Script.Serialization;

namespace photoloader
{
    public partial class AjaxHandler : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var files = (Directory.EnumerateFiles(Server.MapPath("Desktop"),"*.jpg")).ToList();
            List<String> output = new List<string>();
            foreach (var item in files)
            {
                var temp = item.Split('\\');
                output.Add(temp.Last());

           }
            JavaScriptSerializer t = new JavaScriptSerializer();
            String s=t.Serialize(output);
            Response.Clear();
            Response.Write(s);
            Response.End();

        }
    }
}